﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DAL;
using Business.Classes;

namespace UI
{
    public partial class FrmViewImagePostNew : System.Web.UI.Page
    {
        int idImagem = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            idImagem = Convert.ToInt32(Request.QueryString["idImagem"]);

            if (idImagem != 0)
            {
                Imagem imagem = new ImagemBusiness().getImagemByID(idImagem);
                Response.Clear();
                Response.AppendHeader("Content-disposition", "attachment");
                Response.ContentType = "Image/png";
                Response.Charset = string.Empty;
                Response.BinaryWrite(imagem.imagem.ToArray());
                Response.End();
            }
        }
    }
}
